<template>
  <div class="contractOrder">
    <div class="order-content">
      <p class="title">{{$t('message.Contractorders')}}</p>
      <div class="order-type">
        <span @click="color=0" :class="[color==0?'colorType':'']">当前持仓</span>
        <span @click="color=1" :class="[color==1?'colorType':'']">历史持仓</span>
        <!-- <span @click="color=2" :class="[color==2?'colorType':'']">{{$t('message.history')}}</span>
        <span @click="color=3" :class="[color==3?'colorType':'']">{{$t('message.Unwind')}}</span>-->
      </div>
      <!-- ----- -->
      <!-- <div v-if="color==3?false:true" class="condition">
                <el-select class="inputs" size="small" v-model="coinType" :placeholder="$t('message.Contractb')">
                    <el-option
                        v-for="(v,i) in coinList"
                        :key="i"
                        :label="v.childName"
                        :value="v.childId"
                    ></el-option>
                </el-select>
                <el-select class="inputs" size="small" v-model="entrustType" :placeholder="$t('message.Delegate')">
                    <el-option v-for="(v,i) in entrustList" :key="i" :label="v.name" :value="v.id"></el-option>
                </el-select>
                <el-select class="inputs" size="small" v-model="dealType" :placeholder="$t('message.Transactiontype')">
                    <el-option v-for="(v,i) in dealList" :key="i" :label="v.name" :value="v.id"></el-option>
                </el-select>
                <el-button @click="confrim" size="small" type="primary">{{$t('message.determine')}}</el-button>
            </div>
            <div v-else class="condition">
                <el-date-picker
                    size="small"
                    class="inputs"
                    v-model="startTime"
                    type="date"
                    :placeholder="$t('message.Thestarttime')"
                ></el-date-picker>
                <el-date-picker
                    size="small"
                    class="inputs"
                    v-model="endTime"
                    type="date"
                    :placeholder="$t('message.endoftime')"
                ></el-date-picker>
                <el-select class="inputs" size="small" v-model="coinType" :placeholder="$t('message.Contractb')">
                    <el-option
                        v-for="(v,i) in coinList"
                        :key="i"
                        :label="v.childName"
                        :value="v.childId"
                    ></el-option>
                </el-select>
                <el-select class="inputs" size="small" v-model="closeOutType" :placeholder="$t('message.Opentype')">
                    <el-option v-for="(v,i) in closeOutList" :key="i" :label="v.name" :value="v.id"></el-option>
                </el-select>
                <el-button size="small" type="primary">{{$t('message.determine')}}</el-button>
      </div>-->
      <!-- ---- -->
      <div v-show="color==0?true:false" class="currentEntrust">
        <el-table :data="currentEntrust" style="width: 100%">
          <el-table-column prop label="建仓时间" min-width="130">
            <template slot-scope="scope">
              <!-- <span>{{scope.row.trade_kind_name + '(' + scope.row.trade_kind+ ')'}}</span> -->
              <span>{{ scope.row.create_date | timing}}</span>
            </template>
          </el-table-column>
          <el-table-column prop label="交易品种" min-width="50">
            <template slot-scope="scope">
              <!-- <span>{{scope.row.trade_kind_name + '(' + scope.row.trade_kind+ ')'}}</span> -->
              <span>{{ scope.row.trade_kind}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="cost" label="合约价值" min-width="70"></el-table-column>
          <el-table-column prop label="方向" min-width="50">
            <template slot-scope="scope">
              <span v-if="scope.row.trade_type == 'sel'">卖出</span>
              <span v-if="scope.row.trade_type == 'buy'">买入</span>
            </template>
          </el-table-column>
          <el-table-column prop="volumn" label="手数" min-width="50"></el-table-column>

          <el-table-column prop="open_price" label="建仓价" min-width="50"></el-table-column>
          <el-table-column prop="stop_win_price" label="止盈价" min-width="50"></el-table-column>
          <el-table-column prop="stop_loss_price" label="止损价" min-width="50"></el-table-column>
          <!-- <el-table-column prop="stop_loss_price" label="手续费" min-width="50">
            <template slot-scope="scope">
              <span>{{ scope.row.cost * 0.1 }}</span>
            </template>
          </el-table-column> -->
          <el-table-column prop label="实时盈亏" min-width="70">
            <template slot-scope="scope">
              <span v-if="scope.row.trade_type == 'sel'">
                <span
                  v-if="scope.row.trade_kind == 'BTCUSDT'"
                >{{(subFun(scope.row.open_price,BTCUSDT)*scope.row.volumn*10) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'ETHUSDT'"
                >{{(subFun(scope.row.open_price,ETHUSDT)*scope.row.volumn*40) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'LTCUSDT'"
                >{{(subFun(scope.row.open_price,LTCUSDT)*scope.row.volumn*50) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'HS300'"
                >{{(subFun(scope.row.open_price,HS300USDT)*scope.row.volumn*40) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'IC500'"
                >{{(subFun(scope.row.open_price,IC500USDT)*scope.row.volumn*40) | pointThree}}</span>
              </span>
              <span v-if="scope.row.trade_type == 'buy'">
                <span
                  v-if="scope.row.trade_kind == 'BTCUSDT'"
                >{{(subFun(BTCUSDT,scope.row.open_price)*scope.row.volumn*10) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'ETHUSDT'"
                >{{(subFun(ETHUSDT,scope.row.open_price)*scope.row.volumn*40) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'LTCUSDT'"
                >{{(subFun(LTCUSDT,scope.row.open_price)*scope.row.volumn*50) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'HS300'"
                >{{(subFun(HS300USDT,scope.row.open_price)*scope.row.volumn*40) | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'IC500'"
                >{{(subFun(IC500USDT,scope.row.open_price)*scope.row.volumn*40) | pointThree}}</span>
              </span>
            </template>
          </el-table-column>
          <el-table-column label="操作" min-width="100">
            <template slot-scope="scope">
              <el-button @click="details(scope.row)" size="medium">详情</el-button>
              <el-button @click="close(scope.row)" type="primary" size="medium">平仓</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div v-show="color==1?true:false" class="historyEntrust">
        <el-table :data="historyEntrust" style="width: 100%">
          <el-table-column prop label="建仓时间" min-width="130">
            <template slot-scope="scope">
              <!-- <span>{{scope.row.trade_kind_name + '(' + scope.row.trade_kind+ ')'}}</span> -->
              <span>{{ scope.row.create_date | timing}}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="update_date" label="平仓时间" width="170">
            <template slot-scope="scope">
              <span>{{scope.row.update_date | timing}}</span>
            </template>
          </el-table-column>-->
          <el-table-column prop label="交易品种" min-width="100">
            <template slot-scope="scope">
              <!-- <span>{{scope.row.trade_kind_name + '(' + scope.row.trade_kind+ ')'}}</span> -->
              <span>{{scope.row.trade_kind}}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column prop="trade_kind" label="交易种类" min-width="100"></el-table-column> -->

          <el-table-column prop="cost" label="合约价值" min-width="100"></el-table-column>
          <el-table-column prop label="方向" min-width="100">
            <template slot-scope="scope">
              <span v-if="scope.row.trade_type == 'sel'">卖出</span>
              <span v-if="scope.row.trade_type == 'buy'">买入</span>
            </template>
          </el-table-column>
          <el-table-column prop="volumn" label="手数" min-width="40"></el-table-column>

          <el-table-column prop="open_price" label="建仓价" min-width="100"></el-table-column>
          <el-table-column prop="stop_win_price" label="止盈价" min-width="100"></el-table-column>
          <el-table-column prop="stop_loss_price" label="止损价" min-width="100"></el-table-column>
          <!-- <el-table-column prop="stop_loss_price" label="手续费" min-width="50">
            <template slot-scope="scope">
              <span>{{ scope.row.cost * 0.1 }}</span>
            </template>
          </el-table-column> -->
          <el-table-column prop label="盈亏" min-width="100">
            <template slot-scope="scope">
              <!-- <span v-if="scope.row.trade_type == 'buy'">{{ (scope.row.close_price - scope.row.open_price)  | pointThree}}</span>
              <span v-if="scope.row.trade_type == 'sel'">-{{ (scope.row.open_price - scope.row.close_price)  | pointThree}}</span>-->
              <span v-if="scope.row.trade_type == 'buy'">
                <span
                  v-if="scope.row.trade_kind == 'BTCUSDT'"
                >{{(scope.row.close_price - scope.row.open_price)*scope.row.volumn*10 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'ETHUSDT'"
                >{{(scope.row.close_price - scope.row.open_price)*scope.row.volumn*40 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'LTCUSDT'"
                >{{(scope.row.close_price - scope.row.open_price)*scope.row.volumn*50 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'HS300'"
                >{{(scope.row.close_price - scope.row.open_price)*scope.row.volumn*40 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'IC500'"
                >{{(scope.row.close_price - scope.row.open_price)*scope.row.volumn*40 | pointThree}}</span>
              </span>
              <span v-if="scope.row.trade_type == 'sel'">
                <span
                  v-if="scope.row.trade_kind == 'BTCUSDT'"
                >{{(scope.row.open_price - scope.row.close_price)*scope.row.volumn*10 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'ETHUSDT'"
                >{{(scope.row.open_price - scope.row.close_price)*scope.row.volumn*40 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'LTCUSDT'"
                >{{(scope.row.open_price - scope.row.close_price)*scope.row.volumn*50 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'HS300'"
                >{{(scope.row.open_price - scope.row.close_price)*scope.row.volumn*40 | pointThree}}</span>
                <span
                  v-if="scope.row.trade_kind == 'IC500'"
                >{{(scope.row.open_price - scope.row.close_price)*scope.row.volumn*40 | pointThree}}</span>
              </span>
            </template>
          </el-table-column>
          <el-table-column label="操作" min-width="180">
            <template slot-scope="scope">
              <el-button @click="details(scope.row)" size="medium">详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <!-- 详情弹框 -->
      <el-dialog title="详情" :visible.sync="dialogVisible" width="70%">
        <div class="content">
          <p>
            <span>建仓时间：</span>
            {{ DetailedData.create_date | timing }}
          </p>
          <p>
            <span>平仓时间：</span>
            {{ DetailedData.update_date | timing }}
          </p>
          <p>
            <span>交易标的：</span>
            {{ DetailedData.trade_kind }}
          </p>
          <p>
            <span>开仓价格：</span>
            {{ DetailedData.open_price }}
          </p>
          <p>
            <span>平仓价格：</span>
            {{ DetailedData.close_price }}
          </p>
          <p>
            <span>手数：</span>
            {{ DetailedData.volumn }}
          </p>
          <p>
            <span>合约价值：</span>
            {{ DetailedData.cost }}
          </p>
          <p v-if="color==0">
            <span>盈亏</span>
            <span v-if="DetailedData.trade_type == 'buy'">
              <span
                v-if="DetailedData.trade_kind == 'BTCUSDT'"
              >{{subFun(BTCUSDT,DetailedData.open_price)*DetailedData.volumn*10 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'ETHUSDT'"
              >{{subFun(ETHUSDT,DetailedData.open_price)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'LTCUSDT'"
              >{{subFun(LTCUSDT,DetailedData.open_price)*DetailedData.volumn*50 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'HS300'"
              >{{subFun(HS300USDT,DetailedData.open_price)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'IC500'"
              >{{subFun(IC500USDT,DetailedData.open_price)*DetailedData.volumn*40 | pointThree}}</span>
            </span>
            <span v-if="DetailedData.trade_type == 'sel'">
              <span
                v-if="DetailedData.trade_kind == 'BTCUSDT'"
              >{{subFun(DetailedData.open_price,BTCUSDT)*DetailedData.volumn*10 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'ETHUSDT'"
              >{{subFun(DetailedData.open_price,ETHUSDT)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'LTCUSDT'"
              >{{subFun(DetailedData.open_price,LTCUSDT)*DetailedData.volumn*50 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'HS300'"
              >{{subFun(DetailedData.open_price,HS300USDT)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'IC500'"
              >{{subFun(DetailedData.open_price,IC500USDT)*DetailedData.volumn*40 | pointThree}}</span>
            </span>
          </p>
          <p v-if="color==1">
            <span>盈亏</span>
            <span v-if="DetailedData.trade_type == 'buy'">
              <span
                v-if="DetailedData.trade_kind == 'BTCUSDT'"
              >{{(DetailedData.close_price - DetailedData.open_price)*DetailedData.volumn*10 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'ETHUSDT'"
              >{{(DetailedData.close_price - DetailedData.open_price)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'LTCUSDT'"
              >{{(DetailedData.close_price - DetailedData.open_price)*DetailedData.volumn*50 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'HS300'"
              >{{(DetailedData.close_price - DetailedData.open_price)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'IC500'"
              >{{(DetailedData.close_price - DetailedData.open_price)*DetailedData.volumn*40 | pointThree}}</span>
              <!-- {{ DetailedData.close_price - DetailedData.open_price  | pointThree}} -->
            </span>
            <span v-if="DetailedData.trade_type == 'sel'">
              <!-- {{ DetailedData.open_price - DetailedData.close_price  | pointThree}} -->
              <span
                v-if="DetailedData.trade_kind == 'BTCUSDT'"
              >{{(DetailedData.open_price - DetailedData.close_price)*DetailedData.volumn*10 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'ETHUSDT'"
              >{{(DetailedData.open_price - DetailedData.close_price)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'LTCUSDT'"
              >{{(DetailedData.open_price - DetailedData.close_price)*DetailedData.volumn*50 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'HS300'"
              >{{(DetailedData.open_price - DetailedData.close_price)*DetailedData.volumn*40 | pointThree}}</span>
              <span
                v-if="DetailedData.trade_kind == 'IC500'"
              >{{(DetailedData.open_price - DetailedData.close_price)*DetailedData.volumn*40 | pointThree}}</span>
            </span>
          </p>
          <p>
            <span>手续费：</span>
            {{ DetailedData.cost*0.1 }}
          </p>

          <p>
            <span>单号：</span>
            {{ DetailedData.receiptnum }}
          </p>

          <!-- <p v-if="color==0"><span>止盈比例：</span><el-input style="width:150px;" v-model="inputWin" placeholder="设置止盈点"></el-input></p> -->
          <p>
            <span>止盈比例：</span>
            {{ DetailedData.stop_win *100}}%
          </p>
          <p>
            <span>止盈价格：</span>
            {{ DetailedData.stop_win_price }}
          </p>

          <!-- <p><span>止损比例：</span><el-input style="width:150px;" v-model="inputLoss" placeholder="设置止损点"></el-input></p> -->
          <p>
            <span>止损比例：</span>
            {{ DetailedData.stop_loss*100 }}%
          </p>
          <p>
            <span>止损价格：</span>
            {{ DetailedData.stop_loss_price }}
          </p>

          <p v-show="DetailedData.remarks !== 'app'">
            <span>平仓类型：</span>
            {{ DetailedData.remarks }}
          </p>
          <p v-show="DetailedData.remarks == 'app'">
            <span>平仓类型：</span>
            手动平仓
          </p>
          <p>
            <span>延期费：</span>
            {{ DetailedData.storage_cost }}
          </p>

          <p v-if="DetailedData.trade_type == 'buy'">
            <span>方向：</span>买入
          </p>
          <p v-if="DetailedData.trade_type == 'sel'">
            <span>方向：</span>卖出
          </p>
        </div>

        <span slot="footer" class="dialog-footer">
          <!-- <el-button type="primary" @click="stopBtn">确认设置</el-button> -->
          <el-button type="primary" @click="dialogVisible = false">关闭</el-button>
        </span>
      </el-dialog>
      <p v-if="color==1" style="text-align: right;"><span>当前第{{ pageNum }}页</span> <el-button  @click="upKey">上一页</el-button><el-button @click="add">下一页</el-button></p>
      
    </div>
  </div>
</template>
<script>
import moment from "moment";
import {
  getAllAgreement,
  positionGetlist,
  hisposition,
  modifyPosition,
  closePosition,
  getPosition
} from "../api/api";
import qs from "qs";
import { mapState } from "Vuex";
export default {
  data() {
    return {
      orLogin: window.sessionStorage.getItem("user"),
      coinList: [],

      dialogVisible: false,
      DetailedData: {},
      // 1
      color: 0,
      // 2
      coinType: "",
      entrustType: "",
      dealType: "",
      startTime: "",
      endTime: "",
      closeOutType: "",
      // 3
      currentEntrust: [],
      historyEntrust: [],
      closeOut: [],
      // 4
      currentPage: 1,
      currentPageTwo: 1,
      totalOne: 0,
      totalTwo: 0,
      createDate: "",
      inputWin: "",
      inputLoss: "",
      value1: "0",
      page: 0,
      pageNum:1,
    };
  },

  computed: {
    ...mapState([
      "user",
      "tableList",
      "product",
      "BTCUSDT",
      "ETHUSDT",
      "LTCUSDT",
      "IC500USDT",
      "HS300USDT"
    ]),
    // 限价市价
    entrustList() {
      var entrustList = [
        {
          name: this.$t("message.price"),
          id: "1"
        },
        {
          name: this.$t("message.marketprice"),
          id: "2"
        }
      ];
      return entrustList;
    },
    // 买入开多
    dealList() {
      var dealList = [
        {
          name: this.$t("message.buymore"),
          id: "1"
        },
        {
          name: this.$t("message.sellmore"),
          id: "2"
        },
        {
          name: this.$t("message.moreflat"),
          id: "3"
        },
        {
          name: this.$t("message.jersey"),
          id: "4"
        }
      ];
      return dealList;
    },
    // 手动平仓
    closeOutList() {
      var closeOutList = [
        {
          name: this.$t("message.Manual"),
          id: "1"
        },
        {
          name: this.$t("message.Automatic"),
          id: "2"
        },
        {
          name: this.$t("message.Forced"),
          id: "3"
        }
      ];
      return closeOutList;
    }
  },
  created() {
    this.getEntrustList();
    this.getEntrustHistoryList();
  },
  filters: {
    dealTypes(val) {
      if (val == "buy") {
        return "买入";
      } else if (val == "sel") {
        return "卖出";
      }
    },
    timing(val) {
      return moment(val).format("YYYY-MM-DD HH:mm:ss");
    },
    pointThree(val) {
      return Number(val).toFixed(2);
    }
  },
  methods: {
    upKey(){
      if(this.pageNum <= 1 ){
        return false
      } 
      this.pageNum -= 1
      this.page -= 10
      this.getEntrustHistoryList()
    },
    add() {
      if(this.pageNum < 1 || this.historyEntrust.length < 10 ){
        return false
      } 
      this.pageNum += 1
      this.page += 10
      this.getEntrustHistoryList()
    },
    subFun(arg1, arg2) {
      var r1, r2, m, n;
      try {
        r1 = arg1.toString().split(".")[1].length;
      } catch (e) {
        r1 = 0;
      }
      try {
        r2 = arg2.toString().split(".")[1].length;
      } catch (e) {
        r2 = 0;
      }
      m = Math.pow(10, Math.max(r1, r2));
      n = r1 >= r2 ? r1 : r2;
      return ((arg1 * m - arg2 * m) / m).toFixed(n);
    },
    close(row) {
      var params = {
        guid: "001",
        loginId: JSON.parse(this.orLogin).Customer.loginId,
        sessionId: JSON.parse(this.orLogin).SessionId,
        positionId: row.id
      };

      closePosition(params).then(res => {
        // this.currentEntrust = res.data.PositionList
        // console.log(res.data.PositionList,654)
        console.log(res);
        if (res.data.ResultCD == "I001") {
          this.$message({
            message: "平仓成功",
            type: "success"
          });
          this.dialogVisible = false;
          this.getEntrustList();
          this.getEntrustHistoryList();
        } else {
          this.$message.error(res.data.ErrorMsg);
        }
      });
    },
    stopBtn() {
      var params = {
        guid: "001",
        loginId: JSON.parse(this.orLogin).Customer.loginId,
        sessionId: JSON.parse(this.orLogin).SessionId,

        positionId: this.DetailedData.id,
        limit: this.inputWin,
        stop: this.inputLoss,
        deferred: this.value1
        // page: this.currentPage,
        // rows: 3,
        // virtualWalletId: this.coinType,
        // entrustType: this.entrustType
      };
      modifyPosition(params).then(res => {
        // this.currentEntrust = res.data.PositionList
        // console.log(res.data.PositionList,654)
        console.log(res);
      });
    },
    dateFormat(row, column) {
      var moment = require("moment");
      var date = row[column.property];
      return moment(date).format("YYYY-MM-DD HH:MM:SS");
    },
    formatDate(now) {
      var year = now.getFullYear();
      var month = now.getMonth() + 1;
      var date = now.getDate();
      var hour = now.getHours();
      var minute = now.getMinutes();
      var second = now.getSeconds();
      return (
        year +
        "-" +
        month +
        "-" +
        date +
        " " +
        hour +
        ":" +
        minute +
        ":" +
        second
      );
    },
    details(row) {
      this.dialogVisible = true;
      let data = {
        guid: "001",
        loginId: JSON.parse(this.orLogin).Customer.loginId,
        sessionId: JSON.parse(this.orLogin).SessionId,

        positionId: row.id
      };

      getPosition(data).then(res => {
        console.log(JSON.parse(res), 85639);
      });
      this.DetailedData = row;
      this.createDate = moment(this.DetailedData.create_date).format(
        "YYYY-MM-DD HH:MM:SS"
      );
      this.inputWin = this.DetailedData.stop_win;
      this.inputLoss = this.DetailedData.stop_loss;
      this.value1 = this.DetailedData.cost_place;
      console.log(this.value1);
    },
    //当前持仓
    getEntrustList() {
      var params = {
        guid: "001",
        loginId: JSON.parse(this.orLogin).Customer.loginId,
        sessionId: JSON.parse(this.orLogin).SessionId
        // page: this.currentPage,
        // rows: 3,
        // virtualWalletId: this.coinType,
        // entrustType: this.entrustType
      };
      positionGetlist(params).then(res => {
        this.currentEntrust = res.data.PositionList;
        console.log(res.data.PositionList, 654);
      });
    },
    //历史委托
    getEntrustHistoryList() {
      var params = {
        guid: "001",
        loginId: JSON.parse(this.orLogin).Customer.loginId,
        sessionId: JSON.parse(this.orLogin).SessionId,
        skip: this.page,
        pagesize: 10
      };
      hisposition(params).then(res => {
        this.historyEntrust = res.data.PositionList;
      });
    },
    //确定
    confrim() {
      if (this.color == 1) {
        this.getEntrustList();
      } else {
        this.getEntrustHistoryList();
      }
    }
  }
};
</script>
<style lang="less" scoped>
.colorType {
  color: #6881ff;
  border-bottom: 2px solid #6881ff;
  padding-bottom: 5px;
}

.inputs {
  width: 120px;
  margin-right: 10px;
  .el-input__inner {
    background-color: #f7f7fb !important;
  }
}
.wt-btn {
  color: #6881ff;
}
.pc-btn {
  color: rgb(38, 102, 240);
}
.content {
  p {
    line-height: 40px;
    padding-left: 50px;
    span {
      padding: 0px 15px;
    }
  }
}
.contractOrder {
  min-height: 700px;
  padding: 120px 0;
  background-color: #fff;
  min-height: 700px;
  .order-content {
    max-width: 1200px;
    margin: 0 auto;
    color: #2d2f56;
    .title {
      font-size: 24px;
      font-weight: bold;
    }
    .order-type {
      margin: 20px 0 0;
      > span {
        font-size: 14px;
        margin-right: 30px;
        font-weight: bold;
        opacity: 0.8;
        cursor: pointer;
      }
    }
    .condition {
      margin: 30px 0 0;
      background-color: #f7f7fb;
      padding: 15px 10px;
      box-sizing: border-box;
    }
  }
}
</style>


